package com.company.project.rest;

import com.company.project.protocol.pay.CallbackPaymentReq;
import com.company.project.protocol.pay.CallbackPaymentRes;
import com.company.project.protocol.pay.CreatePaymentReq;
import com.company.project.protocol.pay.CreatePaymentRes;
import com.company.project.web.TradeCouponController;
import com.company.project.web.TradePayController;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@Api(value="支付服务")
@Component
@RestController
@RequestMapping("/trade/pay")
public class PayApi extends TradePayController {
    /**
     *  创建支付订单
     * @param createPaymentReq
     * @return
     */
    @Override
    @ApiOperation(value="创建支付订单")
    @PostMapping("/createPayment")
    public CreatePaymentRes createPayment( CreatePaymentReq createPaymentReq) {
        return this.tradePayService.createPayment(createPaymentReq);
    }

    /**
     * 支付回调
     * @param callbackPaymentReq
     * @return
     */
    @Override
    @ApiOperation(value="支付回调")
    @PostMapping("/callbackPayment")
    public CallbackPaymentRes callbackPayment( CallbackPaymentReq callbackPaymentReq) {
        return this.tradePayService.callbackPayment(callbackPaymentReq);
    }
}
